home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / jpsrc2.zip / USAGE < prev   
Text File  |  1991-12-11  |  8KB  |  163 lines

  1. USAGE instructions for the Independent JPEG Group's JPEG software
  2. =================================================================
  3.  
  4. This distribution contains software to implement JPEG image compression and
  5. decompression.  JPEG (pronounced "jay-peg") is a standardized compression
  6. method for full-color and gray-scale images.  JPEG is intended for
  7. "real-world" scenes; cartoons and other non-realistic images are not its
  8. strong suit.  JPEG is lossy, meaning that the output image is not necessarily
  9. identical to the input image.  Hence you should not use JPEG if you have to
  10. have identical output bits.  However, on typical images of real-world scenes,
  11. very good compression levels can be obtained with no visible change, and
  12. amazingly high compression levels can be obtained if you can tolerate a
  13. low-quality image.
  14.  
  15. This file describes usage of the standard programs "cjpeg" and "djpeg" that
  16. can be built directly from the distributed software.  See the README file for
  17. hints on incorporating the JPEG software into other programs.
  18.  
  19. If you are on a Unix machine you may prefer to read the Unix-style manual
  20. pages in files cjpeg.1 and djpeg.1.
  21.  
  22. NOTE: at some point we will probably redesign the user interface, so the
  23. command line switches described here will change.
  24.  
  25.  
  26. We provide two programs, cjpeg to compress an image file into JPEG format,
  27. and djpeg to decompress a JPEG file back into a conventional image format.
  28.  
  29. On Unix-like systems, you say:
  30.     cjpeg [switches] [imagefile] >jpegfile
  31. or
  32.     djpeg [switches] [jpegfile]  >imagefile
  33. The programs read the specified input file, or standard input if none is
  34. named.  They always write to standard output (with trace/error messages to
  35. standard error).  These conventions are handy for piping images between
  36. programs.
  37.  
  38. On PC, Macintosh, and Amiga systems, you say:
  39.     cjpeg [switches] imagefile jpegfile
  40. or
  41.     djpeg [switches] jpegfile  imagefile
  42. i.e., both input and output files are named on the command line.  This style
  43. is a little more foolproof, and it loses no functionality if you don't have
  44. pipes.  (You can get this style on Unix too, if you prefer, by defining
  45. TWO_FILE_COMMANDLINE; see SETUP.)
  46.  
  47. The currently supported image file formats are: PPM (PBMPLUS color format),
  48. PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster Toolkit
  49. format).  (RLE is supported only if the URT library is available.)
  50. cjpeg recognizes the input image format automatically, with the exception
  51. of some Targa-format files.
  52.  
  53. The only JPEG file format currently supported is the JFIF format.  Support for
  54. the TIFF/JPEG format will probably be added at some future date.
  55.  
  56.  
  57. The command line switches for cjpeg are:
  58.  
  59.     -Q quality    Scale quantization tables to adjust image quality.
  60.             Quality is 0 (worst) to 100 (best); default is 75.
  61.             (See below for more info.)
  62.  
  63.     -o        Perform optimization of entropy encoding parameters.
  64.             Without this, default encoding parameters are used.
  65.             -o usually makes the JPEG file a little smaller, but
  66.             cjpeg runs much slower.  Image quality and speed of
  67.             decompression are unaffected by -o.
  68.  
  69.     -T        Input file is Targa format.  Targa files that contain
  70.             an "identification" field will not be automatically
  71.             recognized by cjpeg; for such files you must specify
  72.             -T to force cjpeg to treat the input as Targa format.
  73.  
  74.     -I        Generate noninterleaved JPEG file (not yet supported).
  75.  
  76.     -a        Use arithmetic coding rather than Huffman coding.
  77.             (Not currently supported for legal reasons.)
  78.  
  79.     -d        Enable debug printout.  More -d's give more printout.
  80.             Also, version information is printed at startup.
  81.  
  82. The -Q switch lets you trade off compressed file size against quality of the
  83. reconstructed image: the higher the -Q setting, the larger the JPEG file, and
  84. the closer the output image will be to the original input.  Normally you want
  85. to use the lowest -Q setting (smallest file) that decompresses into something
  86. visually indistinguishable from the original image.  For this purpose the -Q
  87. setting should be between 50 and 95; the default of 75 is often about right.
  88. If you see defects at -Q 75, then go up 5 or 10 counts at a time until you are
  89. happy with the output image.  (The optimal setting will vary from one image to
  90. another.)
  91.  
  92. -Q 100 will generate a quantization table of all 1's, eliminating loss in the
  93. quantization step (but there is still information loss in subsampling, as well
  94. as roundoff error).  This setting is mainly of interest for experimental
  95. purposes.  -Q values above about 95 are NOT recommended for normal use; the
  96. compressed file size goes up dramatically for hardly any gain in output image
  97. quality.
  98.  
  99. In the other direction, -Q values below 50 will produce very small files of
  100. low image quality.  Settings around 5 to 10 might be useful in preparing an
  101. index of a large image library, for example.  Try -Q 2 (or so) for some
  102. amusing Cubist effects.  (Note: -Q values below about 25 generate 2-byte
  103. quantization tables, which are considered optional in the JPEG standard.
  104. cjpeg emits a warning message when you give such a -Q value, because some
  105. commercial JPEG programs may be unable to decode the resulting file.)
  106.  
  107.  
  108. The command line switches for djpeg are:
  109.  
  110.     -G        Select GIF output format (implies -q, with default
  111.             of 256 colors).
  112.  
  113.     -P        Select PPM or PGM output format (this is the default).
  114.             PGM is emitted if the JPEG file is gray-scale or if -g
  115.             is specified.
  116.  
  117.     -R        Select RLE output format.  Requires URT library.
  118.  
  119.     -T        Select Targa output format.  Gray-scale format is
  120.             emitted if the JPEG file is gray-scale or if -g is
  121.             specified; otherwise, colormapped format is emitted
  122.             if -q is specified; otherwise, 24-bit full-color
  123.             format is emitted.
  124.  
  125.     -b        Perform cross-block smoothing.  This is quite
  126.             memory-intensive and only seems to improve the image
  127.             at very low quality settings (-Q 10 to 20 or so).
  128.             At normal -Q settings it may make the image worse.
  129.  
  130.     -g        Force gray-scale output even if input is color.
  131.  
  132.     -q N        Quantize to N colors.
  133.  
  134.     -D        Do NOT use dithering in color quantization.
  135.             By default, Floyd-Steinberg dithering is applied when
  136.             quantizing colors, but on some images dithering may
  137.             result in objectionable "graininess".  If that
  138.             happens, you can turn off dithering with -D.
  139.  
  140.     -2        Use two-pass color quantization (not yet supported).
  141.  
  142.     -d        Enable debug printout.  More -d's give more printout.
  143.             Also, version information is printed at startup.
  144.  
  145. Color quantization currently uses a rather shoddy algorithm (although it's not
  146. as horrible when dithered).  Because of this, the GIF output mode is NOT
  147. RECOMMENDED in the current release, except for gray-scale output.  You can get
  148. better results by applying ppmquant to the unquantized (PPM) output of djpeg,
  149. then converting to GIF with ppmtogif.  (See SUPPORTING SOFTWARE in the README
  150. file.)  We expect to provide a considerably better quantization algorithm in a
  151. future release.  (The same applies to colormapped RLE or Targa output, of
  152. course.)
  153.  
  154. Note that djpeg *can* read noninterleaved JPEG files even though cjpeg can't
  155. yet generate them.  For most applications this is a nonissue, since hardly
  156. anybody seems to be using noninterleaved format.
  157.  
  158. On a non-virtual-memory machine, you may run out of memory if you use -I or -o
  159. in cjpeg, or -q ... -2 in djpeg, or try to read an interlaced GIF file, or try
  160. to read or write an RLE file, or try to read an interlaced or bottom-up Targa
  161. file.  This will be addressed soon by replacing jvirtmem.c with something that
  162. uses temporary files for large images.
  163.